POV-Ray : Newsgroups : povray.newusers : Placing a stopwatch in a fixed position on the image : Re: Placing a stopwatch in a fixed position on the image Server Time
5 Sep 2024 12:19:14 EDT (-0400)
  Re: Placing a stopwatch in a fixed position on the image  
From: John VanSickle
Date: 1 Oct 2000 22:47:26
Message: <39D7F83F.E2013A94@erols.com>
Bill Brehm wrote:
> 
> Thanks John. I've been experimenting with this and have noticed some
> "problems". I don't quite have a full picture of what the matrix
> command is doing, so I haven't been able to solve these problems on my
> own.

I maintain a page that explains what the matrix transform does.

The matrix in the example code moves objects so that they are in front
of the camera.

> 1) With a CamZoom of 2.5, I see no distortion in the sphere. At CamZoom = 1,
> I can see the sphere beginning to distort. With low CamZooms of 0.1, the
> sphere gets really stretched out. It looks like it's being stretched towards
> a vanishing point at the center of the field of view. Perhaps it is alway
> stretched parallel to CamD, but it isn't noticeable when the zoom is high
> and the camera is far away.

I never use a zoom of .1, and rarely use one below 2, so I don't experience
this problem.

One thing you can do is to render the stopwatch as a series of GIFs and use
them as small image-mapped polygons in the corner of the screen; since they
are flat, they will not be distorted.

> 2) If CamLoc is located along the Y axis, I get "error: Singular matrix in
> MInvers."

This is a problem when the vector from CamLoc to CamEye is parallel to
CamSky.  You appear to be using a z-up, y-forward camera system, or are shooting
for a bird's eye view; in either case, change CamSky to point in some other
direction (CamSky=z, for instance).

> 3) I notice with text (replacing the sphere) that has depth, that the depth
> is more visible the further the text is from the center of the field of
> view. I can give the text an aribrarily small depth , but it would be nice
> to be able to give it zero depth so it is always flat. Is there a way?

Yes.  Specify zero depth.  It's perfectly legal.

> 4) I need a fudge factor, greater than 1, in the camera location position,
> otherwise the text disappears. I think it is directly to the right of the
> camera and therefore is not in the field of view.

Fudge factoring the camera location is WRONG for the effect we're trying
to achieve here.  You're looking for a way to place the text so that if
follows the camera; therefore if it doesn't, alter the text placement, and
NOT the camera placement.

Remember that when text is declared, it is placed at the origin, with its
depth extending in the positive z direction, and the width going in the
positive x direction.  Move the text when you declare it, and then apply
the matrix, like this:

text { ttf "myfont.ttf", "Text",0,0
  translate -x*TextWidth  // you need to figure out how wide this is
  scale .1 // to make it smaller
  translate <2/3-.05,-.45,CamZoom>
  matrix < CamR.x,CamR.y,CamR.z, CamU.x,CamU.y,CamU.z,
           CamD.x,CamD.y,CamD.z, CamLoc.x,CamLoc.y,CamLoc.z >
}

Regards,
John

-- 
ICQ: 46085459


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.